package com.bjpowernode.controller;

import com.bjpowernode.entity.TActivityRemark;
import com.bjpowernode.query.ActivityRemarkQuery;
import com.bjpowernode.result.Result;
import com.bjpowernode.service.ActivityRemarkService;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 活动备注
 */
@RestController
public class ActivityRemarkController {

    @Resource
    private ActivityRemarkService activityRemarkService;

    /**
     * 添加活动备注
     * @param activityRemarkQuery
     * @return
     */
    @PostMapping("/api/activityRemark")
    public Result addActivityRemark(@RequestBody ActivityRemarkQuery activityRemarkQuery) {

        int num = activityRemarkService.saveRemark(activityRemarkQuery);
        return num > 0 ? Result.OK() : Result.FAIL();
    }


    /**
     * 分页查询活动备注
     */
    @GetMapping("/api/activityRemark")
    public Result getActivityRemarkByPage(Integer current, Integer activityId) {
        PageInfo<TActivityRemark> pageInfo =  activityRemarkService.getActivityRemarkByPage(current, activityId);
        return Result.OK(pageInfo);
    }

}
